Skip to content

Conversation

@jarebudev
Copy link
Contributor

This PR

Adds unit tests to increase test coverage. I noticed there was some missing whilst working on #1633 and seemed worth contributing these in.

Related Issues

N/A

Notes

N/A

Follow-up Tasks

N/A

How to test

N/A

@jarebudev jarebudev requested review from a team as code owners November 7, 2025 13:59
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jarebudev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the test coverage and robustness of the SDK by introducing several new unit tests. These tests specifically target the supportsFlagValueType logic across various Hook implementations and address an edge case in the ImmutableContext merging functionality, ensuring more reliable behavior.

Highlights

  • New Hook Type Tests: Added dedicated unit tests for BooleanHook, DoubleHook, IntegerHook, ObjectHook, and StringHook to verify their supportsFlagValueType method correctly identifies supported and unsupported flag value types.
  • ImmutableContext Merge Test: Introduced a new test case for ImmutableContext.merge() to ensure that keys are correctly obtained from an overriding context when the existing context is initially empty.
  • HookFixtures Update: Updated the HookFixtures interface to include a mockObjectHook() method, facilitating the creation of mock ObjectHook instances for testing purposes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a suite of unit tests for various Hook implementations (BooleanHook, DoubleHook, IntegerHook, ObjectHook, StringHook) to verify the supportsFlagValueType method. It also adds a test case for ImmutableContext.merge and the necessary fixtures. The changes are a good step towards increasing test coverage. I've provided a couple of suggestions to improve the new tests: one to fix a potentially flaky test by using an order-independent assertion, and another to maintain consistency in test class visibility.

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ObjectHookTest implements HookFixtures {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other test classes in this PR and to follow the good practice of keeping test classes package-private unless necessary, the public modifier can be removed. In JUnit 5, test classes are not required to be public.

Suggested change
public class ObjectHookTest implements HookFixtures {
class ObjectHookTest implements HookFixtures {

@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.73%. Comparing base (9f43e80) to head (040fc11).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1708      +/-   ##
============================================
+ Coverage     92.00%   93.73%   +1.72%     
- Complexity      519      530      +11     
============================================
  Files            52       52              
  Lines          1276     1276              
  Branches        112      112              
============================================
+ Hits           1174     1196      +22     
+ Misses           64       46      -18     
+ Partials         38       34       -4     
Flag Coverage Δ
unittests 93.73% <ø> (+1.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jarebudev and others added 3 commits November 7, 2025 11:08
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Todd Baert <[email protected]>
@toddbaert toddbaert force-pushed the chore_add_test_coverage branch from feca229 to 040fc11 Compare November 7, 2025 16:08
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 7, 2025

@toddbaert toddbaert merged commit 8c0eac6 into open-feature:main Nov 7, 2025
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants